package me.zhengjie.utils.enums;


/**
 * @author 黄星星
 * @date 2020-06-25
 */
public enum RiskLevelEnum {
    MATERIAL_RISK(1L, "重大风险", "material_risk"),
    GREATER_RISK(2L, "较大风险", "greater_risk"),
    GENERAL_RISK(3L, "一般风险", "general_risk"),
    LOW_RISK(4L, "低风险", "low_risk"),
    ;
    private Long id;
    private String name;
    private String code;

    RiskLevelEnum(Long id, String name, String code) {
        this.id = id;
        this.name = name;
        this.code = code;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static RiskLevelEnum find(Long id) {
        for (RiskLevelEnum riskLevelEnum : RiskLevelEnum.values()) {
            if (id.equals(riskLevelEnum.getId())) {
                return riskLevelEnum;
            }
        }
        return null;
    }
}
